//
//  RightViewController.m
//  SlideViewTest
//
//  Created by Nancy on 13-7-11.
//  Copyright (c) 2013年 Nancy. All rights reserved.
//

#import "RightViewController.h"
#import "Right_1_ViewController.h"
#import "collectionViewController.h"
#import "model.h"

@interface RightViewController ()

@end

@implementation RightViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self)
    {
        self.title = @"右侧边栏";   
        self.view.backgroundColor = [UIColor yellowColor];
    }
    return self;
}

-(void)goToSubViewRight:(id)sender
{
    [self.viewDeckController closeRightViewBouncing:^(IIViewDeckController *controller) {
        collectionViewController *collcetion=[model shareCollection];
        self.viewDeckController.centerController=[[UINavigationController alloc] initWithRootViewController:collcetion];
        self.view.userInteractionEnabled = YES;
    }];
    
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [leftBtn setTitle:@"Click Me" forState:UIControlStateNormal];
    [leftBtn.titleLabel setFont:[UIFont systemFontOfSize:14.0]];
    leftBtn.frame = CGRectMake((320-100)/2, (460-30.0-44)/2, 100.0, 30.0);
    [leftBtn addTarget:self action:@selector(goToSubViewRight:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:leftBtn];
    
    UIImageView *view=[[UIImageView alloc] initWithFrame:CGRectMake(65, 0, self.view.frame.size.width-65, self.view.frame.size.height)];
    view.image=[UIImage imageNamed:@"youcebianlan@2x.png"];
    view.userInteractionEnabled=YES;
    [view addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(goToSubViewRight:)]];
    [self.view addSubview:view];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
